package com.eastfair.venuebooking.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 任务
 * </p>
 *
 * @author linan
 * @date 2022-07-06
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionTaskFinishStatusEnum", description = "完成状态 #{NOT_FINISHED:未完成;HAVE_IN_HAND:进行中;COMPLETED:已完成-枚举")
public enum ExhibitionTaskFinishStatusEnum implements BaseEnum {

    /**
     * NOT_FINISHED="未完成"
     */
    NOT_FINISHED("未完成"),
    /**
     * HAVE_IN_HAND="进行中"
     */
    HAVE_IN_HAND("进行中"),
    /**
     * COMPLETED="已完成"
     */
    COMPLETED("已完成"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionTaskFinishStatusEnum match(String val, ExhibitionTaskFinishStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionTaskFinishStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionTaskFinishStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_FINISHED,HAVE_IN_HAND,COMPLETED", example = "NOT_FINISHED")
    public String getCode() {
        return this.name();
    }

}
